package com.glodon.paas.document.storage.web;

import java.io.IOException;
import java.io.InputStream;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class VersionController {

    @RequestMapping("/version")
    public void version(HttpServletResponse resp) throws IOException {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("version.properties");
        String versionInfo = IOUtils.toString(is);
        is.close();
        resp.getWriter().print(versionInfo);
    }
}
